package edu.ujf.sharepas.rcp;

import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.graphics.Image;
import edu.ujf.sharepas.impl.User;

public class UserListLabelProvider extends LabelProvider {

	private Map imageCache = new HashMap(11);
	

	public Image getImage(Object element) {
		User user = (User) element ;
		if(user.isConnected()){
			if(!user.isBusy()){
				return Activator.getImageDescriptor("icons/user-16x16.png").createImage();
			}else{
				return null;//Activator.getImageDescriptor("icons/user-16x16.png").createImage();
			}
		}else{
			return Activator.getImageDescriptor("icons/offline-user-16x16.png").createImage();
		}

	}

	@Override
	public String getText(Object element) {
		return ((User) element).getName();
	}


}
